package cn.easyshipping.cloud.common.exception;


import cn.easyshipping.cloud.common.constant.ErrorCode;

/**
 * 业务异常
 */
public class BusinessException extends RuntimeException{
    /**
     * 异常编号
     */
    private final String messageCode;

    /**
     * 对messageCode 异常信息进行补充说明
     */
    private final String detailMessage;

    public BusinessException(String messageCode, String message) {
        super(message);
        this.messageCode = messageCode;
        this.detailMessage = message;
    }
    /**
     * 构造函数
     */
    public BusinessException(ErrorCode code) {
        this(code.getErrorCode(), code.getErrorMsg());
    }

    public BusinessException(String errorMsg) {
        this(ErrorCode.businessErrorCode.getErrorCode(), errorMsg);
    }

    public String getMessageCode() {
        return messageCode;
    }

    public String getDetailMessage() {
        return detailMessage;
    }
}
